package twi.query.template;

import java.util.HashMap;

import twi_project.TWI;

import com.hp.hpl.jena.ontology.OntClass;

public class NameFactory {

	private static HashMap<String, String> nameMap = new HashMap<String, String>();
	public static void clear(){
		nameMap.clear();
	}

    public static String createIndividualName(OntClass ontClass) {
    	return TWI.getInstance().getOntologieModel().createIndividualName(ontClass.getLocalName());
    }
	public static String createNameFromClass(OntClass cl){
		String on = cl.getLocalName().toLowerCase();
		return createNameFromClassName(on);
	}
	public static String createNameFromClassName(String on) {
		String n = on;
		int c = 0;
		while(nameMap.containsKey(n))
			n = on + c++;
		nameMap.put(n, n);
		return n;
	}
}
